
#include "ti_msp_dl_config.h"
volatile bool gkey;
volatile  uint32_t DAC_value=100;

#define DAC12_REF_VOLTAGE_mV (2500)
/*
 * DAC12 static output voltage in mV
 *  Adjust output as needed and check in DAC_OUT pin
 */
#define DAC12_OUTPUT_VOLTAGE_mV (1300)

int main(void)
{


    SYSCFG_DL_init();
    NVIC_EnableIRQ(KEY_INT_IRQN);
    /* Set output voltage:
     *  DAC value (12-bits) = DesiredOutputVoltage x 4095
     *                          -----------------------
     *                              ReferenceVoltage
     */
    DAC_value = (DAC12_OUTPUT_VOLTAGE_mV * 4095) / DAC12_REF_VOLTAGE_mV;

    DL_DAC12_output12(DAC0, DAC_value);
    DL_DAC12_enable(DAC0);

    while (1)
    {
    if(gkey)
    {
        
        gkey=false;
        if(DAC_value<3000)
        {
            DL_DAC12_output12(DAC0, DAC_value);
            DL_DAC12_enable(DAC0);
            DAC_value+=100;
        }
        else
        {
            DAC_value=100;
        }
    }    
    }
}
void GROUP1_IRQHandler(void)
{
    switch(DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP_1))
    {
        case KEY_INT_IIDX:
        {
            gkey=true;
        }
        default:break;
    }
}
